package com.sieiot.goodknow.base.stable.api;

/**
 * 分页基类。
 * @author lyh
 * @since 2021-07-28
 */
public class PageQO<T> {


    /**
     * 分页页码, 从1起步。
     */
    private Integer pageNum;

    /**
     * 分页每页数据数量，最大值：1000。
     */
    private Integer pageSize;

    /**
     * 分页排序
     */
    private OrderByQO orderByQO;

    /**
     * 分页列表查询对象
     */
    private T querys;


    ////////////////////////// getter setter ////////////////

    public Integer getPageNum() {
        return pageNum < 1 ? 1 : pageNum;
    }

    public void setPageNum(Integer pageNum) {
        if (null == pageNum || pageNum < 1) {
            this.pageNum = 1;
        } else {
            this.pageNum = pageNum;
        }
    }

    public Integer getPageSize() {
        return pageSize < 1 ? 10 : pageSize;
    }

    public void setPageSize(Integer pageSize) {
        if (null == pageSize || pageSize < 1) {
            this.pageSize = 10;
        } else if (this.pageSize > 1000) {
            this.pageSize = 1000;
        } else {
            this.pageSize = pageSize;
        }
    }

    public OrderByQO getOrderByQO() {
        return orderByQO;
    }

    public void setOrderByQO(OrderByQO orderByQO) {
        this.orderByQO = orderByQO;
    }

    public T getQuerys() {
        return querys;
    }

    public void setQuerys(T querys) {
        this.querys = querys;
    }

}
